home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / ARexx / 03 / 04.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-06-11  |  5.2 KB  |  279 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19.  
  20. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  21. line = readln(TempFile)
  22. PicAName = strip(line)
  23. line = readln(TempFile)
  24. Start = strip(line)
  25. line = readln(TempFile)
  26. End = strip(line)
  27. line = readln(TempFile)
  28. IAType = strip(line)
  29. line = readln(TempFile)
  30. ColorA = strip(line)
  31. line = readln(TempFile)
  32. ColorB = strip(line)
  33. line = readln(TempFile)
  34. Border = strip(line)
  35. line = readln(TempFile)
  36. BorderType = strip(line)
  37. line = readln(TempFile)
  38. CropAnswer = strip(line)
  39. call close TempFile
  40.  
  41. Frames = (End - Start)+1
  42. j=0
  43. k=0
  44. TFrames = Frames
  45. TNum = 3
  46. if TFrames > 999 then TNum = 4
  47. if TFrames > 9999 then TNum = 5
  48. if Field = 1 then TFrames = Frames*2
  49. do i = Start to End
  50.     k = k+ 1
  51.     call open TempFile,"RAM:VFXNums",W
  52.     call writeln TempFile,right(k,5,'0')
  53.     call writeln TempFile,right(Frames,5,'0')
  54.     call close TempFile
  55.     f=0
  56.     Redraw Off
  57.     j = j+ 1
  58.     FieldSet = 0
  59.     call DoIt()
  60.     Redraw On
  61.     call SaveIt()
  62.         if Field = 1 then do
  63.             Redraw Off
  64.             j = j + 1
  65.             FieldSet = 1
  66.             call DoIt()
  67.             Redraw On
  68.             call SaveIt()
  69.             end 
  70.     end
  71.     Undo On
  72. exit
  73.  
  74.  
  75.  
  76. LoadA:
  77.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  78.         Undo On
  79.         exit
  80.         end
  81.     if IAType = 0 then do
  82.         LoadBuffer PicAName Force i
  83.         if Field = 1 then do
  84.             GetMain
  85.             parse var result Name Width Height Blah
  86.             if FieldSet = 0 then do
  87.                 Hook DeInterlace
  88.                 Scale Width Height
  89.                 end
  90.             if FieldSet = 1 then do
  91.                 Hook DeInterlace
  92.                 Swap
  93.                 Scale Width Height
  94.                 end
  95.             end
  96.         end
  97.     if IAType = 1 then do
  98.         LoadBuffer PicAName Force 1
  99.         end
  100.     if IAType = 2 then do
  101.         LoadBuffer PicAName Force
  102.         end
  103.     if IAType = 3 then do
  104.         LoadBuffer PicAName""right(i,TNum,'0') Force
  105.         end
  106. return
  107.  
  108. SaveIt:
  109.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  110.         Undo On
  111.         exit
  112.         end
  113.     if SaveType = 0 then do
  114.         call Switcher(TOSW)
  115.         call Switcher(MDV1)
  116.  
  117.         Render Go
  118.         if Field = 1 then
  119.                 call RecordAdd(SaveName,1,6,Compression)
  120.         else
  121.                 call RecordAdd(SaveName,2,6,Compression)
  122.         if j = TFrames then
  123.             call MakeIcon(SaveName,(Frames-10))
  124.         end
  125.  
  126.     if SaveType = 1 then do
  127.         if Field = 1 then do
  128.             f= f + 1
  129.             if f = 1 then
  130.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  131.             if f = 2 then do
  132.                 GetMain
  133.                 parse var result Name Width Height Blah
  134.                 Scale Width Height/2
  135.                 Swap
  136.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  137.                 Scale Width Height/2
  138.                 Hook Interlace
  139.                 SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  140.                 f = 0
  141.                 end
  142.             end
  143.         else do
  144.             SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  145.             end    
  146.         end
  147.  
  148.  
  149. return
  150.  
  151.  
  152.  
  153. DoIt:
  154.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  155.         Undo On
  156.         exit
  157.         end
  158.     call LoadA()
  159.     GetMain
  160.     parse var result Name Width Height Blah
  161.     if CropAnswer ~= "None" then do
  162.         CropAnswer
  163.         Scale Width Height
  164.         end
  165.  
  166.     A = 0
  167.     B = 0
  168.     C = Width
  169.     D = Height
  170.     if BorderType = 1 then do
  171.         Depth = Border
  172.         Blend 90
  173.         NewArea
  174.         DrawMode Lighten
  175.         C = C + A
  176.         D = D + B
  177.         AddArea A+1 B
  178.         AddArea C B
  179.         AddArea C-Depth+1 B+Depth-1
  180.         AddArea A+Depth B+Depth-1
  181.         AddArea A+1 B
  182.         FilledPoly
  183.  
  184.         NewArea
  185.         DrawMode Lighten
  186.         AddArea A B
  187.         AddArea A+Depth-1 B+Depth-1
  188.         AddArea A+Depth-1 D-Depth+1
  189.         AddArea A D
  190.         AddArea A B
  191.         FilledPoly
  192.         FilledPoly
  193.  
  194.         Blend 70
  195.         NewArea
  196.         DrawMode Darken
  197.         AddArea C-Depth+1 B+Depth 
  198.         AddArea C B+1
  199.         AddArea C D 
  200.         AddArea C-Depth+1 D-Depth+1
  201.         AddArea C-Depth+1 B+Depth
  202.         FilledPoly
  203.  
  204.         NewArea
  205.         DrawMode Darken
  206.         AddArea C-1 D
  207.         AddArea A+1 D
  208.         AddArea A+Depth D-Depth+1  
  209.         AddArea C-Depth D-Depth+1 
  210.         AddArea C-1 D
  211.         FilledPoly
  212.         FilledPoly
  213.         end
  214.  
  215.     DrawMode Normal
  216.     Region Full
  217.     Pen 0 1
  218.     Blend 100
  219.     Scissors
  220.     Region Brush
  221.     Box 0 0 Width Height
  222.     Region Full
  223.     FillMode Warp 0 0 0 Smooth
  224.     FilledBox Width/4 Height/4 Width/2 Height/2
  225.     
  226.     Region Brush
  227.     Scale Width/4 Height/4
  228.     BrushHandle 0 0
  229.     Point 0 0
  230.     Point Width/4 0
  231.     Point Width/2 0
  232.     Point Width-(Width/4) 0
  233.  
  234.     Point 0 Height/4
  235.     Point 0 Height/2
  236.     Point Width-(Width/4) Height/4
  237.     Point Width-(Width/4) Height/2
  238.  
  239.     Point 0 Height-(Height/4)
  240.     Point Width/4 Height-(Height/4)
  241.     Point Width/2 Height-(Height/4)
  242.     Point Width-(Width/4) Height-(Height/4)
  243.  
  244.     FillMode Solid 0 0 0 Smooth
  245.     Region Full
  246.     if BorderType = 0 then do
  247.         DrawMode Colorize
  248.         if ColorA = 0 then ColorA = 8
  249.         ActiveColor ColorA
  250.         FilledBox 0 0 Width/4 Height/4
  251.         FilledBox Width/2 0 Width/4 Height/4
  252.         FilledBox Width-(Width/4) Height/4 Width/4 Height/4
  253.         FilledBox Width-(Width/4) Height-(Height/4) Width/4 Height/4
  254.         FilledBox Width/4 Height-(Height/4) Width/4 Height/4
  255.         FilledBox 0 Height/2 Width/4 Height/4
  256.         DrawMode Colorize
  257.         if ColorB = 0 then ColorB = 8
  258.         ActiveColor ColorB
  259.         FilledBox Width/4 0 Width/4 Height/4
  260.         FilledBox Width-(Width/4) 0 Width/4 Height/4
  261.         FilledBox Width-(Width/4) Height/2 Width/4 Height/4
  262.         FilledBox Width/2 Height-(Height/4) Width/4 Height/4
  263.         FilledBox 0 Height-(Height/4) Width/4 Height/4
  264.         FilledBox 0 Height/4 Width/4 Height/4
  265.         DrawMode Normal
  266.         ActiveColor 1
  267.         end
  268.  
  269.     KillBrush
  270.     ActiveColor 16
  271.     Pen 0 3
  272.     Box 0 0 Width Height
  273.     ActiveColor 1
  274.     Pen 0 1
  275.  
  276. return
  277.  
  278.  
  279.